<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>localStorage</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <script src="../../jquery-1.6.2.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="../../reset.css"/>
    <style type="text/css">
        
    </style>
</head>
<body>


<script type="text/javascript">

    function logs() {
        var s = '';
        for (var i = 0,aLen = arguments.length; i < aLen; i++) {
            s += arguments[i] + ' ';
        }
        s = s.slice(0, -1);
        if (!window.console) alert(s);
        else
            console.log(s);
    }

   /**
  * window.localStorage
  *
  * @fileOverview   封装IE  userdata
  * @author 2kid
  * @email 444212235@qq.com
  * @site 2kid.org
  * @version 1.0
  * @date 2011-08-19
  * Copyright (c) 2011-2012 2kid
  * @example
  *   localStorage.setItem('histroys',234);
  */
(function(){
     if(!window.localStorage){
               var Storage;
               Storage=function(){
                   this.o=null;
                   try{
                        this.o = document.createElement('input');
                        this.o.type = "hidden";
                        this.o.addBehavior ("#default#userData");
                        document.body.appendChild(this.o);
                   }catch(e){
                       alert('error');
                   }
               }
               Storage.prototype={
                   setItem:function(key,data){
                       this.o.setAttribute(key, data);
                       this.o.save(key);
                   },
                   getItem:function(key){
                        this.o.load(key);
                        return this.o.getAttribute(key);
                   },
                   removeItem:function(key){
                       this.o.load(key);
                       this.o.removeAttribute(key);
                   }
               }
              window.localStorage=new Storage();
           }

})();
    
  //  localStorage.setItem('histroys','123');
   window.sessionStorage.setItem('abc',123);

  //  var h=$.parseJSON(localStorage.getItem('histroys'))

    window.addEventListener('storage',function(){
         alert(window.sessionStorage['abc'])
    },false);


   // alert(h);
</script>
</body>
</html>


